import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Board from '@/views/board'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
	import weixiurenwu from '@/views/modules/weixiurenwu/list'
	import jianceyuan from '@/views/modules/jianceyuan/list'
	import shebeibaoxiu from '@/views/modules/shebeibaoxiu/list'
	import shebeixinxi from '@/views/modules/shebeixinxi/list'
	import baoxiuchuli from '@/views/modules/baoxiuchuli/list'
	import syslog from '@/views/modules/syslog/list'
	import gangwei from '@/views/modules/gangwei/list'
	import shebeileixing from '@/views/modules/shebeileixing/list'
	import jishurenyuan from '@/views/modules/jishurenyuan/list'
	import jiancebaogao from '@/views/modules/jiancebaogao/list'
	import chat from '@/views/modules/chat/list'
	import bumen from '@/views/modules/bumen/list'
	import diannengzhiliang from '@/views/modules/diannengzhiliang/list'
	import config from '@/views/modules/config/list'


//2.配置路由   注意：名字
export const routes = [{
	path: '/',
	name: '系统首页',
	component: Index,
	children: [{
		// 这里不设置值，是把main作为默认页面
		path: '/',
		name: '系统首页',
		component: Home,
		meta: {icon:'', title:'center', affix: true}
	}, {
		path: '/updatePassword',
		name: '修改密码',
		component: UpdatePassword,
		meta: {icon:'', title:'updatePassword'}
	}, {
		path: '/pay',
		name: '支付',
		component: pay,
		meta: {icon:'', title:'pay'}
	}, {
		path: '/center',
		name: '个人信息',
		component: center,
		meta: {icon:'', title:'center'}
	}
	,{
		path: '/weixiurenwu',
		name: '维修任务',
		component: weixiurenwu
	}
	,{
		path: '/jianceyuan',
		name: '监测员',
		component: jianceyuan
	}
	,{
		path: '/shebeibaoxiu',
		name: '设备报修',
		component: shebeibaoxiu
	}
	,{
		path: '/shebeixinxi',
		name: '设备信息',
		component: shebeixinxi
	}
	,{
		path: '/baoxiuchuli',
		name: '报修处理',
		component: baoxiuchuli
	}
	,{
		path: '/syslog',
		name: '系统日志',
		component: syslog
	}
	,{
		path: '/gangwei',
		name: '岗位',
		component: gangwei
	}
	,{
		path: '/shebeileixing',
		name: '设备类型',
		component: shebeileixing
	}
	,{
		path: '/jishurenyuan',
		name: '技术人员',
		component: jishurenyuan
	}
	,{
		path: '/jiancebaogao',
		name: '监测报告',
		component: jiancebaogao
	}
	,{
		path: '/chat',
		name: '客服中心',
		component: chat
	}
	,{
		path: '/bumen',
		name: '部门',
		component: bumen
	}
	,{
		path: '/diannengzhiliang',
		name: '电能质量',
		component: diannengzhiliang
	}
	,{
		path: '/config',
		name: '轮播图管理',
		component: config
	}
	]
	},
	{
		path: '/login',
		name: 'login',
		component: Login,
		meta: {icon:'', title:'login'}
	},
	{
		path: '/board',
		name: 'board',
		component: Board,
		meta: {icon:'', title:'board'}
	},
	{
		path: '/register',
		name: 'register',
		component: register,
		meta: {icon:'', title:'register'}
	},
	{
		path: '*',
		component: NotFound
	}
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
	mode: 'hash',
	/*hash模式改为history*/
	routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
export default router;
